/**
 * @file	halPeripheral.h
 * @author	chipsea
 * @brief	
 * @version	0.1
 * @date	2020-11-30
 * @copyright Copyright (c) 2020, CHIPSEA Co., Ltd.
 * @note
 */
#ifndef __HAL_PERIPHERAL_H__
#define __HAL_PERIPHERAL_H__

#include "types.h"
#include "key.h"
#include "bleuart_service.h"

#ifdef __cplusplus
extern "C"
{
#endif
    
#define USR_UART_RCV_DATA		0x0001
#define USR_BLE_RCV_DATA		0x0002
#define USR_BLE_SLAVE_RCV_DATA  0x0004
#define USR_CONNECT_LED         0x0008


#define USER_BUF_INDEX	        255
#define USER_BUF_SIZE	        256

#define BT_STATUS_PIN	        P11

typedef enum
{
    STATUS_RESET = 1,
    STATUS_BAUD = 2,
    STATUS_RESTORE = 3,
    STATUS_POWEROFF = 4,
    STATUS_OTA = 5
} STATUS_CHANGE;
extern uint8_t status_change;

extern uint8_t Hal_TaskID;

typedef struct
{
	uint32_t wr;
	uint32_t rd;
	uint8_t  data[USER_BUF_SIZE];
} user_data_t;

/*********************************************************************
 * FUNCTIONS
 */
void ble_data_rec_evt(ble_data_evt_t* pev);
uint16 HalPeripheral_ProcessEvent( uint8 task_id, uint16 events );
void HalPeripheral_Init(uint8 task_id);
void peripheral_task_set(uint8 action, uint16 event, uint32 time);
/*********************************************************************
*********************************************************************/

#ifdef __cplusplus
}
#endif

#endif /* HEARTRATE_H */
